#ifndef AUDIOSTREAMENCODER_H
#define AUDIOSTREAMENCODER_H

#include <QThread>
#include <QDebug>
#include <QFile>
#include <QAudioInput>
#include <QAudioFormat>
#include <QAudioDeviceInfo>
#include <QTimer>
#include <QDataStream>
#include <QIODevice>

class AudioStreamEncoder : public QThread
{
    Q_OBJECT
public:
    explicit AudioStreamEncoder();
    void run();
    void startCapture(QThread *thread = 0);
    void stopCapture();

private:
    QAudioInput *audioInput = 0;
    QDataStream *dataBufferStream = 0;
    QIODevice *inputDevice = 0;
    QByteArray dataBuffer;
    bool isRunning = false;
    QThread *parentThread = 0;

signals:
    void chunkReady(QByteArray data);
};

#endif // AUDIOSTREAMENCODER_H
